<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <li
      v-for="(item) in arr"
      :class="{ completed: item.isDone }"
      :key="item.id"
    >
      <div class="view">
        <input v-model="item.isDone" class="toggle" type="checkbox" />
        <label>{{ item.name }}</label>
<!--        <button class="destroy" @click="arr.splice(index, 1)"></button>-->
        <button class="destroy" @click="$emit('del',item.id)"></button>
      </div>
    </li>
  </ul>
</template>

<script>
export default {
  props: ["arr"],
};
</script>
